package com.hysf.ioc.pro1.test;

import com.hysf.ioc.pro1.pojo.Product;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
	public static void main(String[] args) {
		ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
		System.out.println(context);
		Product apple = (Product) context.getBean("apple");
		System.out.println(apple);
		
		Product m17 = (Product) context.getBean("m17");
		System.out.println(m17);
		
//		Product product = context.getBean(Product.class); // 当容器中只有一个bean时，可以直接使用这种方式获取bean
//		System.out.println(product);
	}
}
